/*
 *  This file is part of the SIRIUS libraries for analyzing MS and MS/MS data
 *
 *  Copyright (C) 2024 Bright Giant GmbH
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along with SIRIUS.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 *  https://openapi-generator.tech
 *  Do not edit the class manually.
 */


package io.sirius.ms.sdk.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.sirius.ms.sdk.model.SimplePeak;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * BasicSpectrum
 */
@JsonPropertyOrder({
  BasicSpectrum.JSON_PROPERTY_NAME,
  BasicSpectrum.JSON_PROPERTY_MS_LEVEL,
  BasicSpectrum.JSON_PROPERTY_COLLISION_ENERGY,
  BasicSpectrum.JSON_PROPERTY_INSTRUMENT,
  BasicSpectrum.JSON_PROPERTY_PRECURSOR_MZ,
  BasicSpectrum.JSON_PROPERTY_SCAN_NUMBER,
  BasicSpectrum.JSON_PROPERTY_COSINE_QUERY,
  BasicSpectrum.JSON_PROPERTY_PRECURSOR_PEAK,
  BasicSpectrum.JSON_PROPERTY_PEAKS,
  BasicSpectrum.JSON_PROPERTY_ABS_INTENSITY_FACTOR,
  BasicSpectrum.JSON_PROPERTY_MAX_NORM_FACTOR,
  BasicSpectrum.JSON_PROPERTY_SUM_NORM_FACTOR,
  BasicSpectrum.JSON_PROPERTY_L2_NORM_FACTOR,
  BasicSpectrum.JSON_PROPERTY_FIRST_PEAK_NORM_FACTOR
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0")
public class BasicSpectrum {
  public static final String JSON_PROPERTY_NAME = "name";
  @jakarta.annotation.Nullable
  private String name;

  public static final String JSON_PROPERTY_MS_LEVEL = "msLevel";
  @jakarta.annotation.Nullable
  private Integer msLevel;

  public static final String JSON_PROPERTY_COLLISION_ENERGY = "collisionEnergy";
  @jakarta.annotation.Nullable
  private String collisionEnergy;

  public static final String JSON_PROPERTY_INSTRUMENT = "instrument";
  @jakarta.annotation.Nullable
  private String instrument;

  public static final String JSON_PROPERTY_PRECURSOR_MZ = "precursorMz";
  @jakarta.annotation.Nullable
  private Double precursorMz;

  public static final String JSON_PROPERTY_SCAN_NUMBER = "scanNumber";
  @jakarta.annotation.Nullable
  private Integer scanNumber;

  public static final String JSON_PROPERTY_COSINE_QUERY = "cosineQuery";
  @jakarta.annotation.Nonnull
  private Boolean cosineQuery = false;

  public static final String JSON_PROPERTY_PRECURSOR_PEAK = "precursorPeak";
  @jakarta.annotation.Nullable
  private SimplePeak precursorPeak;

  public static final String JSON_PROPERTY_PEAKS = "peaks";
  @jakarta.annotation.Nonnull
  private List<SimplePeak> peaks = new ArrayList<>();

  public static final String JSON_PROPERTY_ABS_INTENSITY_FACTOR = "absIntensityFactor";
  @jakarta.annotation.Nullable
  private Double absIntensityFactor;

  public static final String JSON_PROPERTY_MAX_NORM_FACTOR = "maxNormFactor";
  @jakarta.annotation.Nullable
  private Double maxNormFactor;

  public static final String JSON_PROPERTY_SUM_NORM_FACTOR = "sumNormFactor";
  @jakarta.annotation.Nullable
  private Double sumNormFactor;

  public static final String JSON_PROPERTY_L2_NORM_FACTOR = "l2NormFactor";
  @jakarta.annotation.Nullable
  private Double l2NormFactor;

  public static final String JSON_PROPERTY_FIRST_PEAK_NORM_FACTOR = "firstPeakNormFactor";
  @jakarta.annotation.Nullable
  private Double firstPeakNormFactor;

  public BasicSpectrum() {
  }

  public BasicSpectrum name(@jakarta.annotation.Nullable String name) {
    
    this.name = name;
    return this;
  }

  /**
   * Optional Displayable name of this spectrum.
   * @return name
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setName(@jakarta.annotation.Nullable String name) {
    this.name = name;
  }

  public BasicSpectrum msLevel(@jakarta.annotation.Nullable Integer msLevel) {
    
    this.msLevel = msLevel;
    return this;
  }

  /**
   * MS level of the measured spectrum.  Artificial spectra with no msLevel (e.g. Simulated Isotope patterns) use null or zero
   * @return msLevel
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MS_LEVEL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Integer getMsLevel() {
    return msLevel;
  }


  @JsonProperty(JSON_PROPERTY_MS_LEVEL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMsLevel(@jakarta.annotation.Nullable Integer msLevel) {
    this.msLevel = msLevel;
  }

  public BasicSpectrum collisionEnergy(@jakarta.annotation.Nullable String collisionEnergy) {
    
    this.collisionEnergy = collisionEnergy;
    return this;
  }

  /**
   * Collision energy used for MS/MS spectra  Null for spectra where collision energy is not applicable
   * @return collisionEnergy
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_COLLISION_ENERGY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getCollisionEnergy() {
    return collisionEnergy;
  }


  @JsonProperty(JSON_PROPERTY_COLLISION_ENERGY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setCollisionEnergy(@jakarta.annotation.Nullable String collisionEnergy) {
    this.collisionEnergy = collisionEnergy;
  }

  public BasicSpectrum instrument(@jakarta.annotation.Nullable String instrument) {
    
    this.instrument = instrument;
    return this;
  }

  /**
   * Instrument information.
   * @return instrument
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_INSTRUMENT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getInstrument() {
    return instrument;
  }


  @JsonProperty(JSON_PROPERTY_INSTRUMENT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setInstrument(@jakarta.annotation.Nullable String instrument) {
    this.instrument = instrument;
  }

  public BasicSpectrum precursorMz(@jakarta.annotation.Nullable Double precursorMz) {
    
    this.precursorMz = precursorMz;
    return this;
  }

  /**
   * Precursor m/z of the MS/MS spectrum  Null for spectra where precursor m/z is not applicable
   * @return precursorMz
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_PRECURSOR_MZ)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getPrecursorMz() {
    return precursorMz;
  }


  @JsonProperty(JSON_PROPERTY_PRECURSOR_MZ)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPrecursorMz(@jakarta.annotation.Nullable Double precursorMz) {
    this.precursorMz = precursorMz;
  }

  public BasicSpectrum scanNumber(@jakarta.annotation.Nullable Integer scanNumber) {
    
    this.scanNumber = scanNumber;
    return this;
  }

  /**
   * Scan number of the spectrum.  Might be null for artificial spectra with no scan number (e.g. Simulated Isotope patterns or merged spectra)
   * @return scanNumber
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SCAN_NUMBER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Integer getScanNumber() {
    return scanNumber;
  }


  @JsonProperty(JSON_PROPERTY_SCAN_NUMBER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setScanNumber(@jakarta.annotation.Nullable Integer scanNumber) {
    this.scanNumber = scanNumber;
  }

  public BasicSpectrum cosineQuery(@jakarta.annotation.Nonnull Boolean cosineQuery) {
    
    this.cosineQuery = cosineQuery;
    return this;
  }

  /**
   * True if spectrum is in cosine query normalized format.  Such spectrum is compatible with SpectralLibraryMatch peak assignments to reference spectra.
   * @return cosineQuery
   */
  @jakarta.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_COSINE_QUERY)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public Boolean isCosineQuery() {
    return cosineQuery;
  }


  @JsonProperty(JSON_PROPERTY_COSINE_QUERY)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setCosineQuery(@jakarta.annotation.Nonnull Boolean cosineQuery) {
    this.cosineQuery = cosineQuery;
  }

  public BasicSpectrum precursorPeak(@jakarta.annotation.Nullable SimplePeak precursorPeak) {
    
    this.precursorPeak = precursorPeak;
    return this;
  }

  /**
   * Get precursorPeak
   * @return precursorPeak
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_PRECURSOR_PEAK)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public SimplePeak getPrecursorPeak() {
    return precursorPeak;
  }


  @JsonProperty(JSON_PROPERTY_PRECURSOR_PEAK)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPrecursorPeak(@jakarta.annotation.Nullable SimplePeak precursorPeak) {
    this.precursorPeak = precursorPeak;
  }

  public BasicSpectrum peaks(@jakarta.annotation.Nonnull List<SimplePeak> peaks) {
    
    this.peaks = peaks;
    return this;
  }

  public BasicSpectrum addPeaksItem(SimplePeak peaksItem) {
    if (this.peaks == null) {
      this.peaks = new ArrayList<>();
    }
    this.peaks.add(peaksItem);
    return this;
  }

  /**
   * The peaks of this spectrum which might contain additional annotations such as molecular formulas.
   * @return peaks
   */
  @jakarta.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_PEAKS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public List<SimplePeak> getPeaks() {
    return peaks;
  }


  @JsonProperty(JSON_PROPERTY_PEAKS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setPeaks(@jakarta.annotation.Nonnull List<SimplePeak> peaks) {
    this.peaks = peaks;
  }

  public BasicSpectrum absIntensityFactor(@jakarta.annotation.Nullable Double absIntensityFactor) {
    
    this.absIntensityFactor = absIntensityFactor;
    return this;
  }

  /**
   * Factor to convert relative intensities to absolute intensities.  Might be null or 1 for spectra where absolute intensities are not available (E.g. artificial or merged spectra)  &lt;p&gt;  DEPRECATED: Spectra are always returned with raw intensities.  Use provided normalization factors to normalize on the fly.
   * @return absIntensityFactor
   * @deprecated
   */
  @Deprecated
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ABS_INTENSITY_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getAbsIntensityFactor() {
    return absIntensityFactor;
  }


  @JsonProperty(JSON_PROPERTY_ABS_INTENSITY_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setAbsIntensityFactor(@jakarta.annotation.Nullable Double absIntensityFactor) {
    this.absIntensityFactor = absIntensityFactor;
  }

  public BasicSpectrum maxNormFactor(@jakarta.annotation.Nullable Double maxNormFactor) {
    
    this.maxNormFactor = maxNormFactor;
    return this;
  }

  /**
   * Factor to convert absolute intensities to MAX norm.
   * @return maxNormFactor
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MAX_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getMaxNormFactor() {
    return maxNormFactor;
  }


  @JsonProperty(JSON_PROPERTY_MAX_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMaxNormFactor(@jakarta.annotation.Nullable Double maxNormFactor) {
    this.maxNormFactor = maxNormFactor;
  }

  public BasicSpectrum sumNormFactor(@jakarta.annotation.Nullable Double sumNormFactor) {
    
    this.sumNormFactor = sumNormFactor;
    return this;
  }

  /**
   * Factor to convert absolute intensities to SUM norm.
   * @return sumNormFactor
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SUM_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getSumNormFactor() {
    return sumNormFactor;
  }


  @JsonProperty(JSON_PROPERTY_SUM_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSumNormFactor(@jakarta.annotation.Nullable Double sumNormFactor) {
    this.sumNormFactor = sumNormFactor;
  }

  public BasicSpectrum l2NormFactor(@jakarta.annotation.Nullable Double l2NormFactor) {
    
    this.l2NormFactor = l2NormFactor;
    return this;
  }

  /**
   * Factor to convert absolute intensities to L2 (Euclidean) norm.
   * @return l2NormFactor
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_L2_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getL2NormFactor() {
    return l2NormFactor;
  }


  @JsonProperty(JSON_PROPERTY_L2_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setL2NormFactor(@jakarta.annotation.Nullable Double l2NormFactor) {
    this.l2NormFactor = l2NormFactor;
  }

  public BasicSpectrum firstPeakNormFactor(@jakarta.annotation.Nullable Double firstPeakNormFactor) {
    
    this.firstPeakNormFactor = firstPeakNormFactor;
    return this;
  }

  /**
   * Factor to convert absolute intensities to normalize intensities by first peak intensity.
   * @return firstPeakNormFactor
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_FIRST_PEAK_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Double getFirstPeakNormFactor() {
    return firstPeakNormFactor;
  }


  @JsonProperty(JSON_PROPERTY_FIRST_PEAK_NORM_FACTOR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFirstPeakNormFactor(@jakarta.annotation.Nullable Double firstPeakNormFactor) {
    this.firstPeakNormFactor = firstPeakNormFactor;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BasicSpectrum basicSpectrum = (BasicSpectrum) o;
    return Objects.equals(this.name, basicSpectrum.name) &&
        Objects.equals(this.msLevel, basicSpectrum.msLevel) &&
        Objects.equals(this.collisionEnergy, basicSpectrum.collisionEnergy) &&
        Objects.equals(this.instrument, basicSpectrum.instrument) &&
        Objects.equals(this.precursorMz, basicSpectrum.precursorMz) &&
        Objects.equals(this.scanNumber, basicSpectrum.scanNumber) &&
        Objects.equals(this.cosineQuery, basicSpectrum.cosineQuery) &&
        Objects.equals(this.precursorPeak, basicSpectrum.precursorPeak) &&
        Objects.equals(this.peaks, basicSpectrum.peaks) &&
        Objects.equals(this.absIntensityFactor, basicSpectrum.absIntensityFactor) &&
        Objects.equals(this.maxNormFactor, basicSpectrum.maxNormFactor) &&
        Objects.equals(this.sumNormFactor, basicSpectrum.sumNormFactor) &&
        Objects.equals(this.l2NormFactor, basicSpectrum.l2NormFactor) &&
        Objects.equals(this.firstPeakNormFactor, basicSpectrum.firstPeakNormFactor);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, msLevel, collisionEnergy, instrument, precursorMz, scanNumber, cosineQuery, precursorPeak, peaks, absIntensityFactor, maxNormFactor, sumNormFactor, l2NormFactor, firstPeakNormFactor);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class BasicSpectrum {\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    msLevel: ").append(toIndentedString(msLevel)).append("\n");
    sb.append("    collisionEnergy: ").append(toIndentedString(collisionEnergy)).append("\n");
    sb.append("    instrument: ").append(toIndentedString(instrument)).append("\n");
    sb.append("    precursorMz: ").append(toIndentedString(precursorMz)).append("\n");
    sb.append("    scanNumber: ").append(toIndentedString(scanNumber)).append("\n");
    sb.append("    cosineQuery: ").append(toIndentedString(cosineQuery)).append("\n");
    sb.append("    precursorPeak: ").append(toIndentedString(precursorPeak)).append("\n");
    sb.append("    peaks: ").append(toIndentedString(peaks)).append("\n");
    sb.append("    absIntensityFactor: ").append(toIndentedString(absIntensityFactor)).append("\n");
    sb.append("    maxNormFactor: ").append(toIndentedString(maxNormFactor)).append("\n");
    sb.append("    sumNormFactor: ").append(toIndentedString(sumNormFactor)).append("\n");
    sb.append("    l2NormFactor: ").append(toIndentedString(l2NormFactor)).append("\n");
    sb.append("    firstPeakNormFactor: ").append(toIndentedString(firstPeakNormFactor)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

